package com.apkplug.download.BundleActivator;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import com.apkplug.download.service.FileDownload;
import com.apkplug.download.serviceImp.DownloadServiceImp;
import android.app.Activity;
import android.os.Bundle;
public class DownLoadActivator implements BundleActivator
{	
	private FileDownload filedownloadImp=null;
	private ServiceRegistration m_reg = null;
    public void start(BundleContext context) throws Exception
    {
        System.out.println("dowmload Bundle " + context.getBundle().getBundleId()
            + " has started.");
        //将插件BundleContext上下文保存上供应用其他地方使用
        BundleContextFactory.getInstance().setBundleContext(context);
        filedownloadImp=new DownloadServiceImp();
        //注册服务到apkplug框架中
        m_reg = context.registerService(
        		FileDownload.class.getName(),
        		filedownloadImp
	            ,
	            null);
    }
   
    public void stop(BundleContext context)
    {
        System.out.println("dowmload Bundle " + context.getBundle().getBundleId()
            + " has stopped.");
        m_reg.unregister();
    }
}
